import { makeAutoObservable } from 'mobx';
import { Storage } from '@/utils/storage';
export const markingStore = makeAutoObservable({
  markingFieldChecked: {},
  allNotGoodFatherMap: new Map() as Map<string, number[]>,
  allNotGoodType: Storage.get('allMarkingAllNotGoodType') ? Storage.get('allMarkingAllNotGoodType') : [],
  table: {
    currentPage: 1,
    total: 0,
    pageSize: 14
  },
  setDefaultAllNotGoodType(allNotGoodType) {
    this.allNotGoodType = allNotGoodType;
  },
  setMarkField(checkedList, clumnObj) {
    const checkedObj = {};
    checkedList.forEach(key => {
      if (clumnObj[key]) {
        checkedObj[key] = clumnObj[key];
      }
    });
    this.markingFieldChecked = checkedObj;
  }
});

export default markingStore;
